#include<stdio.h>
#include<algorithm>
int n,q,c[9000];
struct pap {
	int kk,Num;
} a[9000],b[9000];
bool cmp(pap x,pap y) {
	if(x.kk!=y.kk) return x.kk<y.kk;
	return x.Num<y.Num;
}
int main() {
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1; i<=n; i++) scanf("%d",&a[i].kk),a[i].Num=i,b[i].kk=a[i].kk,b[i].Num=a[i].Num;
	int ol=1;
	std::sort(b+1,b+1+n,cmp);
	for(int i=1; i<=n; i++) {
		c[b[i].Num]=i;
	}
	while(q--) {
		int o;
		scanf("%d",&o);
		if(o==1) {
			int x,v;
			scanf("%d%d",&x,&v);
			a[x].kk=v;
			for(int i=1; i<=n; i++) b[i].kk=a[i].kk,b[i].Num=a[i].Num;
			std::sort(b+1,b+1+n,cmp);
			for(int i=1; i<=n; i++) {
//				printf("%d %d\n",b[i].kk,b[i].Num);
				c[b[i].Num]=i;
			}
		}
		if(o==2) {
			int y;
			scanf("%d",&y);
			printf("%d\n",c[a[y].Num]);
		}
	}
	return 0;
}

